using System.ComponentModel.DataAnnotations;

namespace Hospital.Domain
{
    /// <summary>
    /// 检查项目类型表
    /// </summary>
    public class CheckItemType
    {
        /// <summary>
        /// 类型ID
        /// </summary>
        [Key]
        public int Id { get; set; }

        /// <summary>
        /// 类型名称
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 父级类型ID，用于多级分类
        /// </summary>
        public int? ParentId { get; set; }

        /// <summary>
        /// 类型层级：1-一级分类（药品、检查、检验），2-二级分类，3-三级分类
        /// </summary>
        [Required]
        public int Level { get; set; }

        /// <summary>
        /// 类型编码，用于标识分类
        /// </summary>
        [MaxLength(50)]
        public string? Code { get; set; }

        /// <summary>
        /// 类型描述
        /// </summary>
        [MaxLength(500)]
        public string? Description { get; set; }

        /// <summary>
        /// 图标或图片路径
        /// </summary>
        [MaxLength(200)]
        public string? Icon { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnabled { get; set; } = true;

        /// <summary>
        /// 排序顺序
        /// </summary>
        public int SortOrder { get; set; }

        /// <summary>
        /// 删除标记
        /// </summary>
        public bool IsDeleted { get; set; } = false;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdatedTime { get; set; }

        /// <summary>
        /// 导航属性：父级类型
        /// </summary>
        public virtual CheckItemType? Parent { get; set; }

        /// <summary>
        /// 导航属性：子级类型
        /// </summary>
        public virtual ICollection<CheckItemType> Children { get; set; } = new List<CheckItemType>();

        /// <summary>
        /// 导航属性：该类型下的检查项目
        /// </summary>
        public virtual ICollection<CheckItem> CheckItems { get; set; } = new List<CheckItem>();
    }
} 